%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Module summary
%%
%% Main authors: Peter
%% Progress to usefulness:
%%
%%
%% An ets worker supervisor.
%%
%%%%%%%%%%%%%%%%%%%%%%%

-module(ets_worker_sup).
-behaviour(supervisor).
-include("db.hrl").
% OTP interface
-export([start_link/0]).
-export([init/1]).
-export([start_worker/1]).

% OTP
start_link() ->
    io:format("Starting Ets worker Supervisor\n"),
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

init(_Args) ->
    {ok, {{simple_one_for_one, 0, 60},
          [{ets_worker, {ets_worker, start_link, []},
           temporary, 5000, worker, [ets_worker]}]}}.

start_worker(State) ->
    supervisor:start_child(?MODULE, [State]).
